package eirkdbd.lab1.gui.tab.field;

import javax.swing.JTextField;

public class IntField extends JTextField {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public int getValue() {
		int i;
		try {
			i = Integer.parseInt(getText());
		} catch(NumberFormatException ex) {
			i = 0;
		}
		return i;
	}
	
	public void setValue(int i) {
		setText(""+i);
	}
	
	public void clear() {
		setText("");
	}
}